import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Rectangle;

import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.xml.stream.events.Comment;

import com.sun.org.apache.xml.internal.security.encryption.Reference;
	

/**
 * 
 * this class for the logout option
 *
 */
	public class LogoutWin extends JFrame  {
		

		private JPanel logpanel;
		private JLabel logmsg1;
		private JLabel logmsg2;
		
		public LogoutWin (){
			
			initialize();
		}

		
		private void initialize() {
			
			this.setSize(342, 187);
			this.setLocation(80, 80);
			logpanel = new JPanel();
			getContentPane().add(logpanel);
			logpanel.setLayout(null);
			
			logpanel.add(getNO());
			logpanel.add(getYES());
			
			logmsg1 = new JLabel("Are You Sure you want");
			logmsg1.setHorizontalAlignment(SwingConstants.CENTER);
			logmsg1.setBounds(-15, 38, 357, 14);
			logpanel.add(logmsg1);
			
			logmsg2 = new JLabel("to LogOut?");
			logmsg2.setHorizontalAlignment(SwingConstants.CENTER);
			logmsg2.setBounds(-15, 55, 357, 14);
			logpanel.add(logmsg2);
			
			this.setVisible(true);

		}	
		
		/**
		 * 
		 * @return
		 */
		public JButton getYES()
		{
			JButton btnYESButton = new JButton("YES");
			btnYESButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					Global.showMain();
					Global.logOut();
					setVisible(false);
					
				}
			});
			btnYESButton.setBounds(40, 115, 89, 23);
			return btnYESButton;
		}
		/**
		 * 
		 * @return
		 */
		private JButton getNO()
		{
			JButton btnNOButton = new JButton("NO");
			btnNOButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					setVisible(false);
				}
			});
			btnNOButton.setBounds(180, 115, 89, 23);
			return btnNOButton;
		}
		
	}


